package edu.neu.springcloud.service;

import edu.neu.springcloud.dao.CommodityDao;
import edu.neu.springcloud.entity.Commodity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommodityService {
    @Autowired
    private CommodityDao commodityDao;

    public List<Commodity> list(Long id, Long fac_id, String name, Float price) {
        Commodity queryLimitCommodity = new Commodity().setId(id).setFac_id(fac_id).setName(name).setPrice(price);
        return commodityDao.list(queryLimitCommodity);
    }

    public boolean add(Commodity commodity) {
        return commodityDao.add(commodity);
    }

    public boolean update(Commodity commodity) {
        return commodityDao.update(commodity);
    }

    public boolean delete(Long id) {
        return commodityDao.delete(id);
    }
}
